package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import cn.wolfcode.luowowo.member.domain.UserInfo;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class Wenda extends BaseDomain {
    private Destination dest;  //目的地

    private UserInfo author;  //作者

    private Huida hotHuida; //最热回答

    private String title;  //标题

    private String content;  //详细内容

    private WendaTag tag;  //标签

    private Integer replynum = 0;  //回答数

    private Integer addReplynum;  //回答增加数

    private Integer viewnum = 0;  //浏览数

    private Integer addViewnum;  //增加浏览数

    private Integer attennum = 0;  //关注数

    private Integer addAttennum;  //增加关注数

    private Date createTime;  //发布时间

    public String getJsonString(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("destId", dest.getId());
        map.put("destName", dest.getName());
        map.put("authorId",author.getId());
        map.put("authorNickname",author.getNickname());
        map.put("authorHeadImgUrl",author.getHeadImgUrl());
        map.put("authorLevel",author.getLevel());
        map.put("title", title);
        return JSON.toJSONString(map);
    }
}